# -*- coding:utf-8 -*-
import json

import config.Configuration as cfg;
import SaveData as save;

pro = cfg.getDataApi();

# fetch all stock basic data and save to db
data = pro.stock_basic(exchange_id='', list_status='L');
save.stockBase(json.loads(data.to_json(orient='records')));

# fetch all company data and save to db
data = pro.stock_company();
save.stockCompany(json.loads(data.to_json(orient='records')));

# daily K line
data = pro.daily(ts_code='002333.SZ', start_date='20180101', end_date='20181021')
save.stockDaily(json.loads(data.to_json(orient='records')));
